from peewee import *
from .db import BaseModel
from models import utils


class Index(BaseModel):
    ts_code = CharField(primary_key=True)
    name = CharField()
    market = CharField()
    publisher = CharField()
    category = CharField()
    base_date = CharField()
    base_point = FloatField()
    list_date = CharField()

class IndexDaily(BaseModel):
    ts_code = CharField()
    trade_date = CharField()
    close = FloatField()
    open = FloatField()
    high = FloatField()
    low = FloatField()
    pre_close = FloatField()
    change = FloatField()
    pct_change = FloatField()
    vol = FloatField()
    amount = FloatField()
    rsi = FloatField()
    rsi6 = FloatField()
    rsi30 = FloatField()
    cci = FloatField()
    cci6 = FloatField()
    cci30 = FloatField()

    class Meta:
        primary_key = CompositeKey('ts_code', 'trade_date')
